package blackjack;

public class Card {
    // 牌面大小  {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};
    private String rank;

    // 牌的花色  {"Heart", "Diamond", "Club", "Spade"}
    private String suit;

    public Card(String rank, String suit) {
        this.rank = rank;
        this.suit = suit;
    }

    public String getRank() {
        return rank;
    }

    public String getSuit() {
        return suit;
    }

    // 计算牌在 21 points game 中对应的分数 ( "Ace" 需要做特殊处理)
    public int getValue() {
        if (rank == "Jack" || rank == "Queen" || rank == "King") {
            return 10;
        }
        else if (rank == "Ace") {
            return 11;
        }
        return Integer.parseInt(rank);
    }

    // 展示扑克牌的点数和花色信息
    public void displayCard() {
        System.out.println(getRank() + " of " + getSuit());
    }

}
